package com.example.demo.controller;

import com.example.demo.dao.departmentMapper;
import com.example.demo.pojo.Department;
import com.example.demo.pojo.Result;
import com.example.demo.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dep")
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;

    @GetMapping("/staff_num")
    public Result getStaffNum(){
        List<Department> departments = departmentService.countstaffnum();
        if(departments != null){
            return Result.success(departments);
        }else{
            return Result.error("统计失败");
        }
    }

}
